<%@page import="java.util.Map" language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@page import="com.ericsson.web.core.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
<body>
<%
int userId = (Integer)(request.getSession().getAttribute(Constants.USERID));
IDatabase db = HSQLDatabase.getInstance();
String userName = db.getUserNameById(userId);
String userDescription = db.getDescriptionById(userId);

Map<Integer, String> friends = db.getAllUsersExceptMe(userId);

final String edit = request.getContextPath() + "/edit.jsp";
final String friend = request.getContextPath() + "/friend.jsp";
final String logout = request.getContextPath() + "/logout";
final String search = request.getContextPath() + "/search";
%>
<h2>My Space -- Hi <%=userName%></h2><div><a href="<%=logout%>">Logout</a></div>
<p><p>
<pre>
<c:out value="${userDescription}" escapeXml="true" />
</pre>
<p>
<a href="<%=edit%>">edit</a>
<p>
Search Friends: 
<p>
<form action="<%=search%>" method="get">
<input type="text" name="search" size=40 /> <input type="submit" value="Go" />
</form>
<p>
Friends: 
<%
for(Integer i : friends.keySet()) {
%>
<a href="<%=friend%>?id=<%=i%>"><%=friends.get(i)%></a>
<%
}
%>
</body>
</html>